﻿/* 绝版点卷商店新加专卖Array(, 11),*/

var status = -1;
var itemList = Array(
Array(5800000, 1),
Array(5800001, 1),
Array(5800002, 1),
Array(1102798, 1),
Array(1102822, 1),
Array(1102824, 1),
Array(1102831, 1),
Array(1102832, 1),
Array(1102837, 1),
Array(1102841, 1),
Array(1102766, 1),
Array(1004336, 1),
Array(1052852, 1),
Array(1702636, 1),
Array(1702627, 1),
Array(1702628, 1),
Array(1050371, 1),
Array(1051440, 1),
Array(1004040, 1),
Array(1003910, 1),
Array(1003955, 1),
Array(1003943, 1),
Array(1003937, 1),
Array(1004600, 1),
Array(1004595, 1),
Array(1004592, 1),
Array(1004591, 1),
Array(1004590, 1),
Array(1004589, 1),
Array(1004583, 1),
Array(1004580, 1),
Array(1004638, 1),
Array(1004636, 1),
Array(1004635, 1),
Array(1004632, 1),
Array(1004631, 1),
Array(1004630, 1),
Array(1004629, 1),
Array(1004628, 1),
Array(1004638, 1),
Array(1004636, 1),
Array(1004635, 1),
Array(1004632, 1),
Array(1004631, 1),
Array(1004630, 1),
Array(1004629, 1),
Array(1004628, 1),
Array(1004602, 1),
Array(1004601, 1),
Array(1052986, 1),
Array(1102867, 1),
Array(1102864, 1),
Array(1102860, 1),
Array(1102859, 1),
Array(1102858, 1),
Array(1102857, 1),
Array(1102855, 1),
Array(1102854, 1),
Array(1102853, 1),
Array(1102844, 1),
Array(1050293, 1),
Array(1002355, 1),
Array(1003807, 1),
Array(1062126, 1),
Array(1052864, 1),
Array(1050346, 1),
Array(1702562, 1),
Array(1052911, 1),
Array(1051415, 1),
Array(1050343, 1),
Array(1102759, 1),
Array(1102758, 1),
Array(1102643, 1),
Array(1004450, 1),
Array(1004328, 1),
Array(1004276, 1),
Array(1050361, 1),
Array(1051431, 1),
Array(1050340, 1),
Array(1050341, 1),
Array(1702581, 1),
Array(1702575, 1),
Array(1004467, 1),
Array(1004440, 1),
Array(1004469, 1),
Array(1102819, 1),
Array(1102815, 1),
Array(1042348, 1),
Array(1702453, 1),
Array(1702454, 1),
Array(1702455, 1),
Array(1702469, 1),
Array(1702476, 1),
Array(1702487, 1),
Array(1702525, 1),
Array(1702529, 1),
Array(1702562, 1),
Array(1702583, 1),
Array(1062137, 1),
Array(1062183, 1),
Array(1061205, 1),
Array(1062189, 1),
Array(1042293, 1),
Array(1062217, 1),
Array(1062219, 1),
Array(1062208, 1),
Array(1062179, 1),
Array(1062209, 1),
Array(1040193, 1),
Array(1062138, 1),
Array(1042260, 1),
Array(1061206, 1),
Array(1060179, 1),
Array(1042264, 1),
Array(1042269, 1),
Array(1042290, 1),
Array(1062216, 1),
Array(1042329, 1),
Array(1042333, 1),
Array(1042334, 1),
Array(1042345, 1),
Array(1062229, 1),
Array(1042347, 1),
Array(1102274, 1),
Array(1102356, 1),
Array(1102392, 1),
Array(1102617, 1),
Array(1102619, 1),
Array(1102551, 1),
Array(1102615, 1),
Array(1102621, 1),
Array(1102667, 1),
Array(1102675, 1),
Array(1102665, 1),
Array(1102700, 1),
Array(1102708, 1),
Array(1102707, 1),
Array(1102712, 1),
Array(1102725, 1),
Array(1102747, 1),
Array(1102749, 1),
Array(1102755, 1),
Array(1102767, 1),
Array(1102774, 1),
Array(1102778, 1),
Array(1072529, 1),
Array(1072531, 1),
Array(1072851, 1),
Array(1072862, 1),
Array(1072934, 1),
Array(1004213, 1),
Array(1702535, 1),
Array(1072951, 1),
Array(1072943, 1),
Array(1072998, 1),
Array(1073047, 1),
Array(1073046, 1),
Array(1073013, 1),
Array(1073014, 1),
Array(1022194, 1),
Array(1012468, 1),
Array(1032145, 1),
Array(1012388, 1),
Array(1022229, 1),
Array(1012427, 1),
Array(1012436, 1),
Array(1012450, 1),
Array(1012384, 1),
Array(1032210, 1),
Array(1012462, 1),
Array(1022217, 1),
Array(1012472, 1),
Array(1012489, 1),
Array(1012501, 1),
Array(1012510, 1),
Array(1012511, 1),
Array(1003937, 1),
Array(1702431, 1),
Array(1702328, 1),
Array(1004285, 1),
Array(1004284, 1),
Array(1004283, 1),
Array(1004181, 1),
Array(1004197, 1),
Array(1004136, 1),
Array(1102682, 1),
Array(1072924, 1),
Array(1052749, 1),
Array(1002956, 1),
Array(1004038, 1),
Array(1000077, 1),
Array(1000076, 1),
Array(1004055, 1),
Array(1004212, 1),
Array(1004198, 1),
Array(1004239, 1),
Array(1004254, 1),
Array(1004250, 1),
Array(1004268, 1),
Array(1004327, 1),
Array(1004329, 1),
Array(1004329, 1),
Array(1004328, 1),
Array(1004182, 1),
Array(1004072, 1),
Array(1004465, 1),
Array(1004478, 1),
Array(1004473, 1),
Array(1004480, 1),
Array(1102373, 1),
Array(1003459, 1),
Array(1052586, 1),
Array(1050248, 1),
Array(1051285, 1),
Array(1051294, 1),
Array(1051297, 1),
Array(1051302, 1),
Array(1051345, 1),
Array(1051349, 1),
Array(1051350, 1),
Array(1050284, 1),
Array(1050300, 1),
Array(1051367, 1),
Array(1052687, 1),
Array(1052750, 1),
Array(1051409, 1),
Array(1051410, 1),
Array(1052844, 1),
Array(1052872, 1),
Array(1052900, 1),
Array(1082574, 1),
Array(1082620, 1),
Array(1082503, 1),
Array(1112291, 1),
Array(1004044, 1),
Array(1102655, 1),
Array(1004050, 1),
Array(1702456, 1),
Array(1052849, 1),
Array(1102491, 1),
Array(1052853, 1),
Array(1004337, 1),
Array(1004108, 1),
Array(1052725, 1),
Array(1072921, 1),
Array(1702463, 1),
Array(1052850, 1),
Array(1001099, 1),
Array(1051411, 1)
);
var selectedItem = -1;
var selectedCost = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status >= 0) {
            cm.dispose();
            return;
        }
        status--;
    }
    if (status == 0) {
        var selStr = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#亲爱的#r#h ##k您好，请选择您希望购买的道具：";
        for (var i = 0; i < itemList.length; i++) {
            selStr += "\r\n#L" + i + "##i" + itemList[i][0] + ":# #b#t" + itemList[i][0] + "##k   #r" + itemList[i][1]  + "#k点卷#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        var item = itemList[selection];
        if (item != null) {
            selectedItem = item[0];
            selectedCost = item[1];
            cm.sendYesNo("您是否购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷？");
        } else {
            cm.sendOk("出现错误...");
            cm.dispose();
        }
    } else if (status == 2) {
        if (selectedCost <= 0 || selectedItem <= 0) {
            cm.sendOk("购买道具出现错误...");
            cm.dispose();
            return;
        }
        if (cm.getPlayer().getCSPoints(1) >= selectedCost) {
            var gachaponItem = cm.gainGachaponItem(selectedItem, 1, "点卷商店", 3, true);
            if (gachaponItem != -1) {
                cm.gainNX( - selectedCost );
                cm.sendOk("恭喜您成功购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k。");
            } else {
                cm.sendOk("购买失败，请您确认在背包所有栏目窗口中是否有一格以上的空间。");
            }
        } else {
            cm.sendOk("您没有那么多点卷。\r\n\r\n购买#i" + selectedItem + ":# #b#t" + selectedItem + "##k 需要 #r" + selectedCost + "#k 点卷。");
        }
        cm.dispose();
    }
}